﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WPF_QC.QA_ViewModel;
using WPF_QC.ServiceReference2;


namespace WPF_QC.QA_View
{
    /// <summary>
    /// Interaction logic for RunningMachinesStatus.xaml
    /// </summary>
    public partial class RunningMachinesStatus : UserControl
    {
        RunningMachinesStatusViewModel viewModel = new RunningMachinesStatusViewModel();
        private ServiceReference2.Service1Client sr2 = new ServiceReference2.Service1Client();

        public RunningMachinesStatus()
        {
            InitializeComponent();
           // this.Loaded += (s, e) => { this.DataContext = this.viewModel; };

            dgdCurrentMchns.ItemsSource = sr2.GetScheduleData();
            dgdMyShift.ItemsSource = sr2.TestScheduleData();
            machinesDatagrid.ItemsSource = sr2.TeamStatusData();
        }

        private void dgdCurrentMchns_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MachineSchedule ms = (MachineSchedule)e.AddedItems[0];
            dgdSingleMchn.ItemsSource = sr2.SingleMachineRunning(ms.MachineID);
        }





    }
}
